import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  OneToMany,
  ManyToOne,
  JoinColumn,
} from 'typeorm'
import { CategoryEntity } from './category.entity'

@Entity('category_value')
export class CategoryValueEntity {
  @ManyToOne(
    () => CategoryEntity,
    categoryEntity => categoryEntity.categoryValue,
  )
  @JoinColumn({
    // referencedColumnName: 'id',
    name: 'parent_id',
  })
  parent: CategoryEntity

  @PrimaryGeneratedColumn()
  id: number

  @Column()
  name: string
}
